﻿
@using RBS.Admin.Controllers
@model IList<RBS.Core.Model.manager_role>
@{
    ViewBag.Title = "角色管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
    $(function () { 
        $("#btnDelete").click(function () {
            var f_str = "";
            $(".ltable :checkbox[id='chkId']").each(function () {
                if (this.checked && this.value != "undefined") {
                    f_str += this.value + ','; 
                }
            }); 
            $.dialog.confirm("本操作会删除角色及相关权限，是否继续？", function () {  
                        var url = '@Url.Action("RoleDelete")?ids=' + f_str;
                        $.ajax({
                            url: url,
                            type: "post",
                            dataType: 'json',
                            success: function (data) {
                                if (data.IsSuccess) {
                                   
                                    loadPage(data.Data);
                                }
                                else {
                                    //  $("#msgtip").text(data.Msg);
                                    $.dialog.alert(data.Msg);
                                }
                            }
                        }); 
              

            });
              return false;
          });


    });
</script>

 <!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  <a href="@Url.Action("Main", "Home")" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <a href="AdminUserManager"><span>管理员</span></a>
  <i class="arrow"></i>
  <span>角色列表</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div class="toolbar-wrap">
  <div id="floatHead" class="toolbar">
    <div class="l-list">
      <ul class="icon-list">
          <li><a class="add" href="RoleEdit?action=@RBS.Common.RBSEnums.ActionEnum.Add"><i></i><span>新增</span></a> 
          </li>
        <li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
          <li> 
              <a id="btnDelete" class="del" href="#"><i></i><span>删除</span></a>
          </li>
      </ul>
    </div>
    <div class="r-list">
     @using (Html.BeginForm("RoleManage", "Sys", new RouteValueDictionary { { "id", "" } }, FormMethod.Get))
            {
                <input id="kword" name="kword" type="text" class="keyword" value="@Request.QueryString["kword"]"/>
                <input type="submit" value="查询" class="btn-search" accesskey="S" /> 
            }
    </div>
  </div>
</div>
<!--/工具栏-->
<!--列表-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
  <tr>
    <th width="8%">选择</th>
    <th align="left">角色名称</th>
    <th width="12%" align="left">类型</th>
    <th width="12%">操作</th>
  </tr>
 @foreach (var item in ViewData.Model)
 {
     <tr>
         <td align="center">
             @if(item.is_sys==0){
             <input type="checkbox" ID="chkId"  class="checkall"  Value='@item.id' style="vertical-align: middle;" />
             }  
             <input type="hidden" ID="hidId" Value='@item.id' />
         </td>
         <td>
             @Html.ActionLink(item.role_name, "RoleEdit", new {action = @RBS.Common.RBSEnums.ActionEnum.Edit, id = item.id}) 
         </td>
         <td> 
             @(item.role_type == 1 ?"超级用户": "系统用户")
         </td>
         <td align="center">
             @Html.ActionLink("修改", "RoleEdit", new {id = item.id,action = @RBS.Common.RBSEnums.ActionEnum.Edit }) 
         </td>
     </tr>
 } 
</table>
 
<!--/列表-->